home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / UTILS / HSBASIC2.DMS / in.adf / HB2Examples1.3.Lha / Examples / BlockInput / BlockInput.bas < prev    next >
Encoding:
BASIC Source File  |  1994-04-14  |  1.8 KB  |  75 lines

  1. ''
  2. '' $Id: BlockInput.bas,v 1.2 1994/03/16 11:42:40 alex Rel $
  3. ''
  4. '' How to block a window (when busy)
  5. ''
  6. '' Derived from RKM example (c) Copyright 1992 Commodore-Amiga, Inc.
  7. ''
  8.  
  9. DEFINT A-Z
  10.  
  11. 'REM $INCLUDE Exec.bh
  12. 'REM $INCLUDE DOS.bh
  13. 'REM $INCLUDE Intuition.bh
  14. 'REM $INCLUDE Utility.bc
  15.  
  16. DIM SHARED tl&(40)    ' required by BusyPointer.bas
  17.  
  18. REM $INCLUDE BLib/BusyPointer.bas    ' generic busy pointer
  19.  
  20. LIBRARY OPEN "exec.library", LIBRARY_MINIMUM&
  21. LIBRARY OPEN "dos.library", LIBRARY_MINIMUM&
  22. LIBRARY OPEN "intuition.library", LIBRARY_MINIMUM&
  23.  
  24. ' beginBusy
  25. '
  26. ' Clear the requester with InitRequester. This makes a requester of
  27. ' width = 0, height = 0, left = 0, top = 0; in fact, everything is zero.
  28. ' This requester will simply block input to the window until
  29. ' EndRequest is called.
  30. '
  31. ' The pointer is set to the busy pointer
  32. '
  33. SUB beginBusy(BYVAL win&, BYVAL waitRequest&)
  34.     STATIC junk&
  35.  
  36.     busyPointer win&
  37.     InitRequester waitRequest&
  38.     junk& = Request&(waitRequest&, win&)
  39. END SUB
  40.  
  41. '
  42. ' endBusy()
  43. '
  44. ' Routine to reset the pointer to the system default, and remove the
  45. ' requester installed with beginBusy().
  46. '
  47. SUB endBusy(BYVAL win&, BYVAL waitRequest&)
  48.     normalPointer win&
  49.     EndRequest waitRequest&, win&
  50. END SUB
  51.  
  52.  
  53. SUB main
  54.     DIM myreq(Requester_sizeof \ 2)
  55.  
  56.     allocBusyPointer    ' allocate busy pointer imagery
  57.  
  58.     ' Using SADD(...) to set a window title is sailing close to the wind, if
  59.     ' the string were to move in memory, the window title would suddenly
  60.     ' get corrupted... we're being quick & dirty here
  61.     
  62.     SetWindowTitles WINDOW(7), SADD("Busy - Input Blocked" + CHR$(0)), NOT 0&
  63.     beginBusy WINDOW(7), VARPTR(myreq(0))
  64.  
  65.     Delay 150            ' pause for around 3 seconds
  66.  
  67.     endBusy WINDOW(7), VARPTR(myreq(0))
  68.     SetWindowTitles WINDOW(7), SADD("Not Busy" + CHR$(0)), NOT 0&
  69.  
  70.     freeBusyPointer        ' release the busy pointer
  71. END SUB
  72.  
  73. main    ' start the main program
  74. END
  75.